import request from '/@/utils/request';

/**
 * 后端控制菜单模拟json

 */

/**
 * 获取后端动态路由菜单(admin)

 * @param params 要传的参数值，非必传
 * @returns 返回接口数据
 */
export function getUserPageList(params?: object) {
    return request({
        url: '/api/system/user/query/page',
        method: 'get',
        params,
    });
}

export function getUserTreeList() {
    return request({
        url: '/api/system/user/getUserTreeList',
        method: 'get',
    });
}

export function getUserEntity(userId?: String) {
    return request({
        url: '/api/system/user/query/' + userId,
        method: 'get',
    });
}


export function saveUser(keyValue: String, params: object) {
    return request({
        url: '/api/system/user/save?keyValue=' + keyValue,
        method: 'post',
        data: params,
    });
}


export function deleteUsers(userId: String) {
    return request({
        url: '/api/system/user/remove/' + userId,
        method: 'delete',
    });
}

/**
 * 重置密码
 * @param userId
 * @returns
 */
export function resetPassword(userId: string) {
    return request({
        url: '/api/system/login/resetPassword',
        method: 'get',
        params: {userId: userId},
    });
}


export function changePassword(keyValue: String, params?: object) {
    return request({
        url: '/api/system/user/setPassword?keyValue=' + keyValue,
        method: 'post',
        data: params,
    });
}